#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# (c) Copyright 2010 - BidiX@BidiX.info
#
#
'''
    main - main entry point for this app
    
    Description : 
    
    Usage : 
     
'''

from google.appengine.dist import use_library
use_library('django', '1.2')

from google.appengine.ext.webapp.util import run_wsgi_app
from home import Home
from init import Init
from bidix.api import ApiHandler
from bidix.webapp import Application
from bidix.html import ArticlePage
from bidix.mail import SendReport, Mailer
from bidix.task import DailyTask
from bidix.http import Redirect
from bidix.logger import LogPage
from bidix.http.url import Bookmarks
from bidix.test import Test 

application = Application([
                                      ('/api/(?P<kind>.*?)(/(?P<name>.*?)(?P<format>\..*?)?)?', ApiHandler),
                                      ('/a/(?P<name>.*?)', ArticlePage),
                                      ('/bookmarks(/?(?P<key>[^\/]*)).*', Bookmarks),
                                      ('/init', Init),
                                      ('/log', LogPage),
                                      ('/mail', Mailer),
                                      ('/rd', Redirect),
                                      ('/report', SendReport),
                                      ('/task', DailyTask), 
                                      ('/tests(/?(?P<key>[^\/]*)).*', Test),

                                      ('.*', Home),
                                     ],
                                     debug=True)

def main():
    run_wsgi_app(application)

if __name__ == '__main__':
    main()